package com.winter.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.winter.model.FinBond;
import com.winter.service.FinBondService;
import com.winter.util.Result;

@RestController
@RequestMapping("v1/finbond")
public class FinBondController {


    @Autowired
    public FinBondService finBondService;

    /**
     * 查询报价平台列表
     *
     * @return List
     */
    @GetMapping("/fin_bond_list")
    public Result queryPageList(Integer pageNumber, Integer pageSize, String direct, String bond_type, String deadline, String valuation, String userNo, String sortName, String sort, String key) {
        return finBondService.queryPageList(pageNumber, pageSize, direct, bond_type, deadline, valuation, userNo, sortName, sort, key);
    }

    /**
     * 通过id查询报价平台
     *
     * @return bean
     */
    @GetMapping("/fin_bond_id")
    public Result getFinBondId(Long id, String userNo) {
        return finBondService.getFinBondId(id, userNo);
    }

    /**
     * 新增报价平台债券信息
     *
     * @return int
     */
    @PostMapping("/fin_bond_insert")
    public Result insertFinBond(@RequestBody FinBond fb) {
        return finBondService.insertFinBond(fb);
    }

    @PutMapping("/fin_bond_update")
    public Result updateFinBond(@RequestBody FinBond fb) {
        return finBondService.updateFinBond(fb);
    }
}
